FROM ubuntu:16.04
MAINTAINER Li Jian
ENV REFRESHED_AT 2017-12-13

ADD sources.list /etc/apt/sources.list
RUN apt -y update && apt install -y curl unzip
ENV CONSUL_ZIP /consul.zip
ADD https://releases.hashicorp.com/consul/1.0.1/consul_1.0.1_linux_amd64.zip $CONSUL_ZIP
RUN cd /usr/sbin && unzip $CONSUL_ZIP && chmod +x /usr/sbin/consul && rm $CONSUL_ZIP

ADD consul.json /config/
EXPOSE 53/udp 8300 8301 8301/udp 8302 8302/udp 8400 8500
VOLUME ["/data"]

# 新版的consul不再需要安装额外的webui,只需在启动时指定 -ui 参数即可。
ENTRYPOINT ["/usr/sbin/consul", "agent", "-config-dir=/config", "-ui"]
